@echo off
chcp 65001 >nul
echo 🚀 HarmonyOS 快速构建脚本

echo.
echo 📦 构建 Ionic 应用...
call npm run build
if %errorlevel% neq 0 (
    echo ❌ 构建失败
    pause
    exit /b 1
)

echo.
echo 📁 复制文件到 HarmonyOS...
call npm run build:harmonyos
if %errorlevel% neq 0 (
    echo ❌ 文件复制失败
    pause
    exit /b 1
)

echo.
echo 🔨 构建 HarmonyOS 应用...
cd /d "%~dp0ohos"
call hvigor clean
call hvigor assembleHap
if %errorlevel% neq 0 (
    echo ❌ HarmonyOS 构建失败
    cd /d "%~dp0"
    pause
    exit /b 1
)

cd /d "%~dp0"
echo.
echo 🎉 构建完成！
echo 📱 HAP 文件: ohos\entry\build\default\outputs\default\entry-default-signed.hap
pause